<template>
  <el-row>
    <el-tabs value="first">
      <el-tab-pane label="脱贫攻坚数据图" name="first">
        <div class="btn-ss">
          <el-select v-model="value" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
          <div class="btn-text">
            <el-input
              placeholder="请输入内容"
              prefix-icon="el-icon-search"
              v-model="input"
            >
            </el-input>
            <el-button>搜索</el-button>
          </div>
        </div>
        <div class="chart" style="height: 70vh"></div>
      </el-tab-pane>
      <el-tab-pane label="乡村振兴数据图" name="second"> </el-tab-pane>
    </el-tabs>
  </el-row>
</template>

<script>
import * as echarts from "echarts";
export default {
  name: "MyStatistics",
  data() {
    return {
      options: [
        {
          value: "2024",
          label: "2024",
        },
        {
          value: "2023",
          label: "2023",
        },
        {
          value: "2022",
          label: "2022",
        },
        {
          value: "2021",
          label: "2021",
        },
        {
          value: "2020",
          label: "2020",
        },
        {
          value: "2019",
          label: "2019",
        },
      ],
      value: "",
      input: "",
    };
  },
  mounted() {
    const chartDom = document.querySelector(".chart");
    const myChart = echarts.init(chartDom);
    const option = {
      title: {
        text: "脱贫攻坚",
      },
      tooltip: {
        trigger: "axis",
      },
      // legend: {
      //   data: ["Email", "Union Ads", "Video Ads", "Direct", "Search Engine"],
      // },
      grid: {
        left: "3%",
        right: "4%",
        bottom: "3%",
        containLabel: true,
      },
      toolbox: {
        feature: {
          saveAsImage: {},
        },
      },
      xAxis: {
        type: "category",
        boundaryGap: false,
        data: [
          "1月",
          "2月",
          "3月",
          "4月",
          "5月",
          "6月",
          "7月",
          "8月",
          "9月",
          "10月",
          "11月",
          "12月",
        ],
      },
      yAxis: {
        type: "value",
      },

      series: [
        {
          name: "脱贫攻坚",
          type: "line",
          stack: "Total",
          data: [
            1600, 1302, 2001, 1234, 1890, 1290, 1478, 1230, 1552, 2000, 890,
            1890,
          ],
        },
      ],
    };

    myChart.setOption(option);
  },
  methods: {},
};
</script>

<style scoped>
.btn-ss,
.btn-text {
  display: flex;
  justify-content: space-between; /* 水平均分 */
  align-items: center; /* 垂直居中 */
}
</style>